<template>
  <!-- oce 删除 append-to-body -->
  <el-drawer
    :class="[b('dialog'), b('column')]"
    lock-scroll
    :modal-append-to-body="false"
    class="avue-dialog"
    :title="t('crud.showTitle')"
    @opened="rowDrop"
    :size="crud.isMobile ? '100%' : '40%'"
    :visible.sync="columnBox"
  >
    <div style="height: calc(100% - 5px)">
      <el-table
        :data="list"
        ref="table"
        :key="Math.random()"
        height="100%"
        size="small"
        border
      >
        <el-table-column
          align="center"
          width="100"
          header-align="center"
          prop="label"
          :label="t('crud.column.name')"
        >
        </el-table-column>
        <template v-for="(item, index) in crud.defaultColumn">
          <el-table-column
            :prop="item.prop"
            :key="index"
            align="center"
            header-align="center"
            v-if="item.hide != true"
            :label="item.label"
          >
            <template slot-scope="{ row }">
              <el-checkbox
                v-model="crud.objectOption[row.prop][item.prop]"
              ></el-checkbox>
            </template>
          </el-table-column>
        </template>
        <!-- <el-table-column
          prop="11"
          align="center"
          header-align="center"
          :label="'顺序'"
        >
          <template slot-scope="{ row }">
            <el-button
              type="text"
              icon="el-icon-top"
              @click="setPosition(row, -1)"
            />
            <el-button
              type="text"
              icon="el-icon-bottom"
              @click="setPosition(row, 1)"
            />
          </template>
        </el-table-column> -->
      </el-table>
    </div>
  </el-drawer>
</template>

<script>
import { Crud } from '../../../../assets/avue/avue'
export default {
  extends: Crud.components.dialogColumn,
  // mounted() {
  //   console.log(this.crud.defaultColumn)
  // },
  // methods: {
  //   // 修改列位置
  //   setPosition(row, direction) {
  //     console.log(this.crud.objectOption)
  //     console.log(row, direction)
  //     row.index = (row.index || 0) + direction
  //     console.log(11111111111111, row.index)
  //   },
  // },
}
</script>

<style lang="scss" scoped></style>
